package Thread;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86186
 * Date: 2023-08-02
 * Time: 16:40
 */

class MyThread extends Thread {
    @Override
    public void run() {
        while(true) {
            System.out.println("hello world!");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    } 
}
public class TreadDemo1 {
    public static void main(String[] args) {
        Thread thread = new MyThread();
        thread.start();

        while(true) {
            System.out.println("hello main");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
